package com.api.action.v1;

import com.admin.entity.Station;
import com.admin.entity.Theme;
import com.aliyun.OssUpload;
import com.api.service.v1.TerminalApiService;
import com.api.service.v1.WelcomeApiService;
import com.bean.ResponseBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/api/v1")
public class WelcomeApiAction {

    @Autowired
    private WelcomeApiService welcomeApiService;

    @Autowired
    private TerminalApiService terminalApiService;

    @Value("${SERVER}")
    private String ECS_SERVER;

    @Autowired
    private OssUpload ossUpload;

    /**
     * 获取住店客户的用户名
     *
     * @param mac
     * @param id  站点编号
     * @param room 房间号
     * @return
     */
    @RequestMapping("/PMS")
    public String getPmsName(String mac, String id, String room) {
        String name = welcomeApiService.getPmsName(mac,id,room);
        return name;
    }

    /**
     * 获取服务器列表：本地服务器-->OSS服务器--->云服务器
     *
     * @param mac
     * @return
     */
    @RequestMapping("/getServers")
    public ResponseBean getServers(String mac) {
        List list = welcomeApiService.getServers(mac);
        return new ResponseBean(0, "获取成功", list);

    }

    @RequestMapping("/getWelcome")
    public ResponseBean getWelcome(String mac)
    {
        Theme theme =terminalApiService.findThemeByMac(mac);
        return new ResponseBean(200,"success",theme.getThemeWelcomePageAndroidchecked());
    }


}
